function OrderBean(id, policyId, policyTitle, appUserId, matchResultId, serverId, status, delStatus, updateTime, createTime, appUserName, appUserImg, serverUserName, serverUserImg, appUserMobile, serverUserMobile, companyName) {
    if (id instanceof Object) {
        this.id = id.id;
        this.policyId = id.policyId;
        this.policyTitle = id.policyTitle;
        this.appUserId = id.appUserId;
        this.matchResultId = id.matchResultId;
        this.serverId = id.serverId;
        this.status = id.status;
        this.delStatus = id.delStatus;
        this.updateTime = id.updateTime;
        this.createTime = id.createTime;
        this.appUserName = id.appUserName;
        this.appUserImg = id.appUserImg;
        this.serverUserName = id.serverUserName;
        this.serverUserImg = id.serverUserImg;
        this.appUserMobile = id.appUserMobile;
        this.serverUserMobile = id.serverUserMobile;
        this.companyName = id.companyName;
    } else {
        this.id = id;
        this.policyId = policyId;
        this.policyTitle = policyTitle;
        this.appUserId = appUserId;
        this.matchResultId = matchResultId;
        this.serverId = serverId;
        this.status = status;
        this.delStatus = delStatus;
        this.updateTime = updateTime;
        this.createTime = createTime;
        this.appUserName = appUserName;
        this.appUserImg = appUserImg;
        this.serverUserName = serverUserName;
        this.serverUserImg = serverUserImg;
        this.appUserMobile = appUserMobile;
        this.serverUserMobile = serverUserMobile;
        this.companyName = companyName;

    }
}

function onPageReady() {
    ajax({
        url: "/api/order/detail?id=" + $.paramToObj().id,
        type: "post",
        dataType: "json",
        headers: {},
        success: function (result) {
            var item = new OrderBean(result.data);
            $("body").render("#main", item);
            var user = new AppUserBean(item.appUserId, item.appUserName, item.appUserMobile, item.appUserImg, item.appUserImg, item.password, item.userRole, item.registerDate, item.loginCount, item.token, item.loginTime, item.tokenRefreshTime, item.delStatus, item.companyName);
            user.headImg = user.headImg || '../../../img/head.svg';
            user.type = "客户";
            var idStr = (+$.paramToObj().id + 10000) + "";
            user.orderNumber = item.createTime.slice(0, 10).replace(/-/g, '') + idStr.slice(idStr.length - 4, idStr.length);
            $(".customer").render("#customer", user);
            user = new AppUserBean(item.serverId, item.serverUserName, item.serverUserMobile, item.serverUserImg, item.serverUserImg, item.password, item.userRole, item.registerDate, item.loginCount, item.token, item.loginTime, item.tokenRefreshTime, item.delStatus, item.company);
            user.type = "项目匹配师";
            user.company = "天邦菁华";
            user.headImg = user.headImg || '../../../img/head.svg';
            $(".service").render("#service", user);
            ajax({
                url: "/api/match/myDetail?matchId=" + item.matchResultId,
                type: "post",
                dataType: "json",
                headers: {},
                data: {id: ""},
                success: function (result) {
                    var item;
                    var i = 0;
                    for (i in result.data.pass) {
                        item = result.data.pass[i];
                        $(".conformity ul").render("#li", item);
                    }
                    if (!i) {
                        $(".conformity ul").render("#li", {name: '无'});
                    }
                    i = 0;
                    for (i in result.data.fail) {
                        item = result.data.fail[i];
                        $(".inconformity ul").render("#li", item);
                    }
                    if (!i) {
                        $(".inconformity ul").render("#li", {name: '无'});
                    }
                    i = 0;
                    for (i in result.data.todo) {
                        item = result.data.todo[i];
                        $(".culture ul").render("#li", item);
                    }
                    if (!i) {
                        $(".culture ul").render("#li", {name: '无'});
                    }
                }
            });
            alert('项目匹配师' + item.serverUserName + '将在10分钟之内予您电话回复！');
        }
    });

}